package com.gr.dmbackend.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {
    @TableId(type = IdType.AUTO)    // 实现自增
    private Integer id;
    private Integer userId;
    private String studentId;
    private String name;
    private String gender;
    private String grade;
    private String building;
    private String floor;
    private String dormId;

    // 获取姓氏首字母（假设学生姓名是中文）
    public String getFirstLetter() {
        if (name != null && !name.isEmpty()) {
            char firstChar = name.charAt(0);
            return String.valueOf(firstChar);
        }
        return "";
    }
}
